﻿using PoemGame.Domain.GameAggregate;
using PoemService.Shared;

namespace PoemGame.Domain.Feihualing
{
    public class FeihualingGame : Game
    {
        private readonly IPoemService poemService;
        public FeihualingGame(IPoemService _poemService,string gamecontext)
        {
            GameCondition = gamecontext;
            poemService = _poemService;
        }
        protected override bool CheckAnswer(string answer)
        {
            foreach(var record in Records)
            {
                if (record.Answer == answer) return false;
            }
            if (!poemService.IsPoemLineExist(answer).Result || !answer.Contains(GameCondition)) return false;
            return true;
        }

    }
}